<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width"/>
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>我的大学</title>
    <link rel="stylesheet" type="text/css" href="../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../css/main.css" />
</head>
<body>
  <div id="header">
    <div id="back"></div>
      <h3>修改密码</h3>
  </div>
  <div id = "all">
    <div class="form">
        <div class="form-control"><input  placeholder="请输入您的新密码" type="password" id="password"/></div>
        <div class="form-control"><input  placeholder="请再输入一次您的密码" type="password" id="repassword"/></div>
        <div class="form-control"><button class="form-btn" onclick="repassword()" tapmode>修改密码</button></div>
    </div>
  </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/jquery.js"></script>
<script type="text/javascript" src="../../script/main.js"></script>
<script>
  apiready=function(){
    back();
  }
  //修改密码
  function repassword(){
    var password=$("#password").val();
    var repassword=$("#repassword").val();
    var aid=$api.getStorage('aid');
    var jwt=$api.getStorage('jwt');
    var url='/api/paAdmin/'+aid+'/'+'pwd?newPwd='+password;
    var data="";
    if(password!=""&&repassword!=""&&password==repassword){
      var functionRet=function(ret){
      }
      var functionErr=function(err){
        if(err.statusCode==200){
          api.alert({ msg: '密码修改成功！' });
          closeWin();
        }else{
          toast("修改密码失败，请重试","bottom");
        }
      }
      //ajax更新密码
      put(url,data,functionRet,functionErr)
    }else{
      toast("密码不能为空，或您两次输入的密码不一致","bottom");
    }
  }
</script>
</html>
